package com.wms.common.constant;


import com.wms.common.enums.TaskTemplateEnum;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Constant {

    public static final String COMPLETE_TASK_URL = "/api/WMS/crnReleaseOK";

    public static final String ADD = "ADD";
    public static final String SELECT = "SELECT";
    public static final String DELETE = "DELETE";
    public static final String UPDATE = "UPDATE";
    /**
     * PREVENT_DUPLICATION_PREFIX.
     */
    public static final String PREVENT_DUPLICATION_PREFIX = "prevent_duplication_prefix:";

    /**
     * 批次
     */
    public static final String LINE = "line_";
    public static final String STATION = "station_";

    public static final String MENU_NAME = "菜单管理";


    // TODO 根据实际情况修改
    public static final String OPC_HOST = "localhost:38000";
    /**
     * 模式切换关键字
     */
    public static final String PATTERN = "pattern";
    /**
     * 入库线体缓存关键字
     */
    public static final String IN_CACHE = "in_cache";
    /**
     * 返修模式
     */
    public static final String REPAIR = "2";

    /**
     * 盘点模式编码
     */
    public static final String STRAIGHT_HAIR = "3";

    /**
     * 主驾
     */
    public static final String FL = "FL";
    /**
     * 副驾
     */
    public static final String FR = "FR";
    /**
     * 配盘信息
     */
    public static final String IN_DATA = "Indata";
    /**
     * 出库完成
     */
    public static final String OUT_CONFIRM_DATA = "OutConfirmData";
    /**
     * 出库计划
     */
    public static final String OUT_DATA = "OutData";
    public static final String PRODUCTION_DATA = "ProductionData";
    /**
     * 节点名称
     */
    public static final String DATA = "data";
    public static final String JOB = "job";
    /**
     * 后排
     */
    public static final String RS = "RS";

    /**
     * 返修
     */
    public static final String REWORK = "Rework";
    /**
     * VIN前缀
     */
    public static final String VIN_PREFIXES = "VIN_";



    public static String GET_OPC_URL = OPC_HOST + "/api/manage/GetData";
    public static String SET_OPC_URL = OPC_HOST + "/api/manage/SetData";


    public static final String GET_DEVICE_LIST = "/api/Manage/GetDeviceList?DeviceType=PLC";

    public static final String GET_SIGNAL_LIST = "/api/Manage/GetSignalList?DevId=";
    public static final String GET_ALL_DATA = "/api/Manage/GetAllDatas";


    public static final String SQL_LIMIT_1 = " LIMIT 1 ";
    public static final String SQL_LIMIT_5 = " LIMIT 5 ";
    public static final String SQL_LIMIT_60 = " LIMIT 60 ";
    public static final String EXCEL_PRODUCT_NAME = "产品名称";
    public static final String EXCEL_CUSTOMIZE_OFFLINE_SITE_GROUPS = "自定义线下站组";
    public static final String FileName = "LJS";
    //    public static final String EXCEL_CUSTOMIZE_OFFLINE_SITE_GROUPS = "自定义线下站组";
    // 下划线
    public static final String UNDERLINE = "_";

    public static final Map<String, String> DICT_KEY_MAP = new HashMap<>();
    public static final Map<String, Integer> DICT_VALUE_MAP = new HashMap<>();
//    public static final Map<String, List<DictVo>> DICT_VO_MAP = new HashMap<>();

//    public static final String HOIST_URL = "10.8.2.114:30801/api/WMS/Task/genHoistSchedulingTask";
//    public static final String RGV_URL = "10.8.2.114:30801/api/WMS/Task/genRgvSchedulingTask";
//    public static final String LOCAL_URL = "D:/桌面/Interface/";

    public static final String HOIST_URL = "10.72.66.131:30801/api/WMS/Task/genHoistSchedulingTask";
    public static final String RGV_URL = "10.72.66.131:30801/api/WMS/Task/genRgvSchedulingTask";
    public static final String LOCAL_URL = "F:/Interface/";

    /**
     * 主驾
     */
    public static final String ZJ = "FL";

    /**
     * 后排
     */
    public static final String HP = "RS";

    /**
     * 副驾
     */
    public static final String FJ = "FR";
    // 任务模板类型
    /**
     * 起始入库点位编码,系统自定义,只供本系统使用
     */
    public static final String START_PORT = "F16-1";

    /**
     * 返修出库终点
     */
    public static final String REPAIR_POINT = "F16-2";

//    /**
//     * 主驾下线接座椅点位
//     */
//    public static final String ZJ_PORT_1 = "F04-1-FirstFloor";
//    public static final String ZJ_PORT_2 = "F04-1-SecondFloor";
//    /**
//     * 副驾下线点位
//     */
//    public static final String FJ_PORT_1 = "F04";
//    public static final String FJ_PORT_2 = "FJPort_2";

    /**
     * 副驾下线接座椅点位
     */

    // ZJ_PORT_1
    public static final String FJ_PORT_1 = "F04-1-FirstFloor";

    // ZJ_PORT_2
    public static final String FJ_PORT_2 = "F04-1-SecondFloor";
    /**
     * 主驾下线点位
     */
    // FJ_PORT_1
    public static final String ZJ_PORT_1 = "F04";

    // FJ_PORT_2
    public static final String ZJ_PORT_2 = "FJPort_2";

//    /**
//        主驾下线接座椅点位
//    */
//    public static final String ZJ_PORT_1 = "F04";
//    public static final String ZJ_PORT_2 = "FJPort_2";
//    /**
//     * 副驾下线点位
//     */
//    public static final String FJ_PORT_1 = "F04-1-FirstFloor";
//    public static final String FJ_PORT_2 = "F04-1-SecondFloor";

    /**
     * 返修出库滚筒线
     */
    public static final String REPAIR_OUT_POINT = "1|1|2";


    /**
     * 装载换层提升机
     */
    public static final String F13 = "F04-4";

    /**
     * 装载换层提升机
     */
    public static final String F13_CACHING_1 = "F13_CACHING_1";
    public static final String F13_CACHING_2 = "F13_CACHING_2";
    public static final String EMPTY_CACHING_1 = "EMPTY_CACHING_1";
    public static final String EMPTY_CACHING_2 = "EMPTY_CACHING_2";

    public static final String EMPTY_RETURN_1 = "EMPTY_RETURN_1";
    public static final String EMPTY_RETURN_2 = "EMPTY_RETURN_2";

    /**
     * 入库提升机
     */
    public static final String F03_001 = "F06-1-FirstFloor";
    public static final String F03_002 = "F06-1-SecondFloor";

    /**
     * 入库接驳台
     */
    public static final String F21 = "F21";
    public static final String F04_001 = "F06-2-FirstFloor";
    public static final String F04_002 = "F06-2-SecondFloor";

    /**
     * 立库库位
     */
    public static final String XZY = "XYZ";


    public static String LAST = "Last_";
    public static String ONE_LAYER = "ONE_LAYER";
    public static String TWO_LAYER = "TWO_LAYER";
    public static String THREE_LAYER = "THREE_LAYER";
    public static String FOUR_LAYER = "FOUR_LAYER";

    /**
     * 巷道对应堆垛机编号
     */
    public static final String HOIST_1_1 = "1-101";
    public static final String HOIST_1_2 = "1-102";
    public static final String HOIST_1_3 = "1-103";
    public static final String HOIST_1_4 = "1-104";

    /**
     * 一号提升机编码
     */
    public static final String STACKER_1 = "DD01";
    public static final String STACKER_2 = "DD02";

    /**
     * 二号提升机
     */
    public static final String HOIST_2_1 = "2-101";
    public static final String HOIST_2_2 = "2-102";
    public static final String HOIST_2_3 = "2-103";
    public static final String HOIST_2_4 = "2-104";

    /**
     * 三号提升机
     */
    public static final String HOIST_3_1 = "3-101";
    public static final String HOIST_3_2 = "3-102";
    public static final String HOIST_3_3 = "3-103";
    public static final String HOIST_3_4 = "3-104";
    /**
     * 空托盘位置
     */
    public static final String EMPTY_1 = "F09-1-FirstFloor";
    public static final String EMPTY_2 = "F09-1-SecondFloor";
    /**
     * 成套座椅下线途经点
     */
//    public static final List<String> TEMPLATE_1_PASSING_THROUGH_POINTS =
//            List.of(ZJ_PORT_1,
//                    FJ_PORT_1,
//                    F13,
//                    F03_001,
//                    F03_002,
//                    F21,
//                    XZY);
//
//    /**
//     * 主驾单独下线任务模板
//     */
//    public static final List<String> TEMPLATE_2_PASSING_THROUGH_POINTS = List.of(ZJ_PORT_1);
//
//    /**
//     * 副驾单独下线任务模板
//     */
//    public static final List<String> TEMPLATE_3_PASSING_THROUGH_POINTS = List.of(FJ_PORT_1);
//
//    /**
//     * 主驾返修任务模板
//     */
//    public static final List<String> TEMPLATE_4_PASSING_THROUGH_POINTS = List.of(REPAIR_OUT_POINT, REPAIR_POINT, ZJ_PORT_1);
//    /**
//     * 副驾返修任务模板
//     */
//    public static final List<String> TEMPLATE_5_PASSING_THROUGH_POINTS = List.of(REPAIR_OUT_POINT, REPAIR_POINT, ZJ_PORT_2, FJ_PORT_1);
//    /**
//     * 下线入库模板
//     */
//    public static final List<String> TEMPLATE_6_PASSING_THROUGH_POINTS = List.of(F13, F03_001, F03_002, F21, XZY);
//
//    /**
//     * 提升机入库模板
//     */
//    public static final List<String> TEMPLATE_7_PASSING_THROUGH_POINTS = List.of(F21, XZY);
//    public static final List<String> TEMPLATE_8_PASSING_THROUGH_POINTS = new ArrayList<>();
//    public static final List<String> TEMPLATE_9_PASSING_THROUGH_POINTS = List.of(F04_001, F04_002);
//
//    /**
//     * 入库开始 到 提升机之前的点
//     */
//    public static final List<String> LOADING_FRONT_POINT = List.of(START_PORT, ZJ_PORT_1, ZJ_PORT_2, FJ_PORT_1, FJ_PORT_2);

    /**
     * 起始点位待执行的任务模板集合
     */
    public static final List<String> START_TASK_TEMPLATE_LIST = List.of(
            TaskTemplateEnum.TEMPLATE_1.getTemplateCode(), TaskTemplateEnum.TEMPLATE_3.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_2.getTemplateCode(), TaskTemplateEnum.TEMPLATE_5.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_4.getTemplateCode()
    );

    public static final List<String> FJ_AUTO_RELEASE = List.of(
            TaskTemplateEnum.TEMPLATE_3.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_5.getTemplateCode()
    );

    public static final List<String> FJ_NOT_AUTO_RELEASE = List.of(
            TaskTemplateEnum.TEMPLATE_1.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_2.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_4.getTemplateCode()
    );

    public static final List<String> ZJ_LOADING = List.of(
            TaskTemplateEnum.TEMPLATE_1.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_3.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_5.getTemplateCode()
    );

    public static final List<String> FJ_LOADING = List.of(
            TaskTemplateEnum.TEMPLATE_1.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_2.getTemplateCode(),
            TaskTemplateEnum.TEMPLATE_4.getTemplateCode()
    );


    public static final Map<String, String> START_PORT_MAP =
            Map.ofEntries(
                    Map.entry(TaskTemplateEnum.TEMPLATE_1.getTemplateCode(), Constant.FJ_PORT_1),
                    Map.entry(TaskTemplateEnum.TEMPLATE_3.getTemplateCode(), Constant.FJ_PORT_1),
                    Map.entry(TaskTemplateEnum.TEMPLATE_2.getTemplateCode(), Constant.FJ_PORT_1),
                    Map.entry(TaskTemplateEnum.TEMPLATE_5.getTemplateCode(), Constant.FJ_PORT_1),
                    Map.entry(TaskTemplateEnum.TEMPLATE_4.getTemplateCode(), Constant.FJ_PORT_1),
                    Map.entry(TaskTemplateEnum.TEMPLATE_6.getTemplateCode(), Constant.F13)
            );
//    private static final Map<String, String> REPAIR_PORT_MAP =
//            Map.ofEntries(
//                    Map.entry(TaskTemplateEnum.TEMPLATE_1.getTemplateCode(), Constant.ZJ_PORT_1),
//                    Map.entry(TaskTemplateEnum.TEMPLATE_2.getTemplateCode(), Constant.ZJ_PORT_1),
//                    Map.entry(TaskTemplateEnum.TEMPLATE_3.getTemplateCode(), Constant.ZJ_PORT_2),
//                    Map.entry(TaskTemplateEnum.TEMPLATE_4.getTemplateCode(), Constant.ZJ_PORT_1),
//                    Map.entry(TaskTemplateEnum.TEMPLATE_5.getTemplateCode(), Constant.ZJ_PORT_2),
//                    Map.entry(TaskTemplateEnum.TEMPLATE_6.getTemplateCode(), Constant.F03_001)
//            );

    /**
     * 一层点位
     */
    public static final List<String> ONE_FLOOR_POINT = List.of(
            Constant.START_PORT,
            Constant.FJ_PORT_1,
            Constant.ZJ_PORT_1,
            Constant.F13,
            Constant.F03_001,
            Constant.HOIST_1_1,
            Constant.HOIST_2_1,
            Constant.HOIST_3_1,
            Constant.F04_001,
            Constant.EMPTY_1
    );
    /**
     * 二层位置
     */
    public static final List<String> TWO_FLOOR_POINT = List.of(
            Constant.REPAIR_POINT,
            Constant.FJ_PORT_2,
            Constant.ZJ_PORT_2,
            Constant.F03_002,
            Constant.HOIST_1_2,
            Constant.HOIST_2_2,
            Constant.HOIST_3_2,
            Constant.F04_002,
            Constant.EMPTY_2
    );

    /**
     * 二层位置
     */
    public static final List<String> THREE_FLOOR_POINT = List.of(
            Constant.HOIST_1_3,
            Constant.HOIST_2_3,
            Constant.HOIST_3_3
    );

    /**
     * 二层位置
     */
    public static final List<String> FOUR_FLOOR_POINT = List.of(
            Constant.HOIST_1_4,
            Constant.HOIST_2_4,
            Constant.HOIST_3_4
    );


//    public static Map<Integer, String> LAYER_CONFIG = Map.ofEntries(
//            Map.entry(1, ConfigEnum.ONE_LAYER.getConfigCode()),
//            Map.entry(2, ConfigEnum.THREE_LAYER.getConfigCode()),
//            Map.entry(3, ConfigEnum.THREE_LAYER.getConfigCode()),
//            Map.entry(4, ConfigEnum.FOUR_LAYER.getConfigCode())
//    );

    public static Map<Integer, String> LAYER_OUT_MAP = Map.ofEntries(
            Map.entry(1, Constant.HOIST_2_1),
            Map.entry(2, Constant.HOIST_2_2),
            Map.entry(3, Constant.HOIST_2_3),
            Map.entry(4, Constant.HOIST_2_4)
    );
    public static Map<Integer, String> LAYER_MAP = Map.ofEntries(
            Map.entry(1, Constant.HOIST_1_1),
            Map.entry(2, Constant.HOIST_1_2),
            Map.entry(3, Constant.HOIST_1_3),
            Map.entry(4, Constant.HOIST_1_4)
    );

    public static Map<String, Integer> POINT_LAYER_MAP = Map.ofEntries(
            Map.entry(Constant.HOIST_1_1, 1),
            Map.entry(Constant.HOIST_1_2, 2),
            Map.entry(Constant.HOIST_1_3, 3),
            Map.entry(Constant.HOIST_1_4, 4),
            Map.entry(Constant.HOIST_2_1, 1),
            Map.entry(Constant.HOIST_2_2, 2),
            Map.entry(Constant.HOIST_2_3, 3),
            Map.entry(Constant.HOIST_2_4, 4),
            Map.entry(Constant.HOIST_3_1, 1),
            Map.entry(Constant.HOIST_3_2, 2),
            Map.entry(Constant.HOIST_3_3, 3),
            Map.entry(Constant.HOIST_3_4, 4),
            Map.entry(Constant.REPAIR_OUT_POINT, 2),
            Map.entry(Constant.REPAIR_POINT, 2)
    );

    public static Map<Integer, String> LAYER_EMPTY_MAP = Map.ofEntries(
            Map.entry(1, Constant.HOIST_3_1),
            Map.entry(2, Constant.HOIST_3_2),
            Map.entry(3, Constant.HOIST_3_3),
            Map.entry(4, Constant.HOIST_3_4)
    );

    public static List<String> SINGLE_POINT = List.of(
            Constant.REPAIR_POINT,
            Constant.START_PORT,
            Constant.FJ_PORT_1,
            Constant.FJ_PORT_2,
            Constant.ZJ_PORT_1,
            Constant.ZJ_PORT_2,
            Constant.F03_001,
            Constant.F03_002,
            Constant.F04_001,
            Constant.F04_002
    );


    // 一号提升机的点位
    public static List<String> HOIST_1 = List.of(Constant.HOIST_1_1, Constant.HOIST_1_2, Constant.HOIST_1_3, Constant.HOIST_1_4);
    // 二号提升机
    public static List<String> HOIST_2 = List.of(Constant.HOIST_2_1, Constant.HOIST_2_2, Constant.HOIST_2_3, Constant.HOIST_2_4);
    // 三号提升机
    public static List<String> HOIST_3 = List.of(Constant.HOIST_3_1, Constant.HOIST_3_2, Constant.HOIST_3_3, Constant.HOIST_3_4);

}

